/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.webhomesites.locacao.model;

import br.com.webhomesites.padrao.utils.AbstractEntity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

/**
 *
 * @author Webhome
 */
@Entity
@Table(name = "loccontrato")
@NamedQueries({
    @NamedQuery(name = "br.com.webhomesites.locacao.model.EmitirContratoModel.findMaxId", query = "SELECT MAX(id) from EmitirContratoModel p"),
    @NamedQuery(name = "EmitirContratoModel.findMaxIdByIdLocacao", query = "SELECT MAX(i.id) from EmitirContratoModel i, LocacaoModel l where l.id = :idloc and i.locacaoModel.id = l.id"),
    @NamedQuery(name = "EmitirContratoModel.findByIdLocacao", query = "SELECT u FROM EmitirContratoModel u WHERE u.locacaoModel.id = :idloc")
})
public class EmitirContratoModel extends AbstractEntity implements Serializable {

    //private long codigoLocacao;        
    private String locatario;
    private Date dataSaida;
    private Date horaSaida;
    private LocacaoModel locacaoModel;
//    @Transient
//    private Collection<ProdutoModel> listaProdutos;

    @OneToOne
    @JoinColumn(name = "codlocacao", referencedColumnName = "codigo")
    public LocacaoModel getLocacaoModel() {
        return locacaoModel;
    }

    public void setLocacaoModel(LocacaoModel locacaoModel) {
        this.locacaoModel = locacaoModel;
    }

    @Column(name = "dataSaida")
    @Temporal(javax.persistence.TemporalType.DATE)
    public Date getDataSaida() {
        return dataSaida;
    }

    public void setDataSaida(Date dataSaida) {
        this.dataSaida = dataSaida;
    }

    @Column(name = "horaSaida")
    @Temporal(javax.persistence.TemporalType.TIME)
    public Date getHoraSaida() {
        return horaSaida;
    }

    public void setHoraSaida(Date horaSaida) {
        this.horaSaida = horaSaida;
    }

    @Column(name = "locatario")
    public String getLocatario() {
        return locatario;
    }

    public void setLocatario(String locatario) {
        this.locatario = locatario;
    }
}
